package com.kamistoat.meimeimall.meimeimallorder.controller;

import com.kamistoat.meimeimall.common.annotation.DubboAndHTTPExceptionCatch;
import com.kamistoat.meimeimall.common.annotation.LoginRequired;
import com.kamistoat.meimeimall.common.utils.R;
import com.kamistoat.meimeimall.meimeimallorder.entity.SubOrderEntity;
import com.kamistoat.meimeimall.meimeimallorder.service.SubOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 拆分后子订单Controller
 */
@Api(tags = "拆分子订单数据库操作")
@RestController
@RequestMapping("suborder")
public class SubOrderController {
    @Autowired
    private SubOrderService subOrderService;

    /**
     * 列表
     */
    @ApiOperation("从数据库获取列表")
    @GetMapping("/list")
    @LoginRequired
    @DubboAndHTTPExceptionCatch
    //@RequiresPermissions("meimeimallorder:order:list")
    public R list(@RequestParam Map<String, Object> params) {

        return R.ok();
    }


    /**
     * 信息
     */
    @ApiOperation("从数据库查询指定的POJO")
    @GetMapping("/suborder_info")
    @LoginRequired
    @DubboAndHTTPExceptionCatch
    //@RequiresPermissions("meimeimallorder:order:info")
    public R info(@RequestParam("id") Long id) {
        return R.ok();
    }

    /**
     * 保存
     */
    @ApiOperation("向数据库保存POJO")
    @PutMapping("/suborder_info")
    @LoginRequired
    @DubboAndHTTPExceptionCatch
    //@RequiresPermissions("meimeimallorder:order:save")
    public R save(@RequestBody SubOrderEntity subOrder) {
        return R.ok();
    }

    /**
     * 修改
     */
    @ApiOperation("向数据库更新POJO")
    @PostMapping("/suborder_info")
    @LoginRequired
    @DubboAndHTTPExceptionCatch
    //@RequiresPermissions("meimeimallorder:order:update")
    public R update(@RequestBody SubOrderEntity subOrder) {
        return R.ok();
    }

    /**
     * 删除
     */
    @ApiOperation("从数据库删除POJO")
    @DeleteMapping("/suborder_info")
    @LoginRequired
    @DubboAndHTTPExceptionCatch
    //@RequiresPermissions("meimeimallorder:order:delete")
    public R delete(@RequestBody Long[] ids) {
        return R.ok();
    }

}
